package com.hangxin.compare.controller;

import com.hangxin.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文档对比分析 Controller
 */
@Api("文档对比分析")
@RestController
@RequestMapping("/document/comparison")
public class DocumentComparisonController {


    @ApiOperation("查询参数列表")
    @PostMapping("/analyze")
    public AjaxResult analyze(
            @RequestParam("sourceFile") MultipartFile sourceFile,
            @RequestParam("comparativeDocument") MultipartFile comparativeDocument) {
        if (sourceFile.isEmpty() || comparativeDocument.isEmpty()) {
            return AjaxResult.error("请上传两个文件");
        }

        // TODO: 处理文件，比如保存到本地或上传到云存储
        String file1Name = sourceFile.getOriginalFilename();
        String file2Name = comparativeDocument.getOriginalFilename();

        return AjaxResult.success("接收到文件: " + file1Name + " 和 " + file2Name);
    }
}
